

<%@page import="br.com.fatecpg.ads.poo.projeto.conexao.OracleConnector"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/javascript" href="../_res/js/bootstrap.js">
        <link rel="stylesheet" type="text/css" href="../_res/css/bootstrap.css">
        <link rel="stylesheet" type="text/css" href="../_res/css/bootstrap-theme.css">
        <link rel="stylesheet" type="text/css" href="../_res/css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="estilos/estiloPagina.css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%@include file="../_templates/header.jsp"%>
        <%@include file="../_templates/menu.jsp"%>
        <h1>Cadastro de Perfil da Loja</h1>
        
        <form action="" method="get">
                  Nome do BAR <input class="form-control" type="text" name="NM_BAR" value="${param.NM_BAR}"/>
                 CNPJ <input class="form-control" type="text" name="ID_CNPJ" value="${param.ID_CNPJ}"/>
                  Endereco: <input class="form-control" type="text" name="NM_ENDERECO" value="${param.NM_ENDERECO}"/>
                  Cidade: <input class="form-control" type="text" name="NM_CIDADE" value="${param.NM_CIDADE}"/>
                  <input class="btn btn-default" type="submit" value="Cadastrar!">
        </form>
        
        <%
        if(request.getParameter("NM_BAR") != null && (request.getParameter("NM_ENDERECO") != null) && (request.getParameter("NM_ENDERECO") != null)){
            String nomeBar = request.getParameter("NM_BAR");
            String cnpj = request.getParameter("ID_CNPJ");
            String endereco = request.getParameter("NM_ENDERECO");
            String cidade = request.getParameter("NM_CIDADE");
            String SQL = "INSERT INTO PERFIL_BAR(id_cnpj_bar, nm_bar, nm_endereco, nm_cidade)"
                    + " VALUES("+cnpj+",'" + nomeBar + "','" + endereco + "','" + cidade+ "')";           
        
            
            try{
            OracleConnector.executeStatement(SQL);
            }catch(Exception ex){
                out.println("<h3> Erro" + ex.getLocalizedMessage() + "</h3>");
            }
        }
        %>
        <%@include file="../_templates/footer.jsp"%>
    </body>
</html>
